package api

import (
	"gitee.com/hexug/vblog/tree/master/api/apps"
	"gitee.com/hexug/vblog/tree/master/api/apps/user"
	"github.com/gin-gonic/gin"
)

type UserApi struct {
	Svc user.Server
}

func (a *UserApi) Name() string {
	return user.AppName
}

func (a *UserApi) Init() error {
	a.Svc = apps.GetApp(user.AppName).(user.Server)
	return nil
}

func (a *UserApi) RegisterRouter(router gin.IRouter) {
	router.POST("/login", a.Login)
	router.POST("/logout", a.Logout)
}

// 注册api
func init() {
	apps.RegisterApi(&UserApi{})
}
